library EndCinematicsUtils initializer init requires LegacySystem, LegacyHumanAbilities

    globals
        private trigger gg_trg_Bunny_Board
		private location udg_myloc2
    endglobals
    
    private function BunnyBoard takes nothing returns nothing
        local integer i = 1
        loop
            exitwhen i>udg_InitialPlayers
            call LeaderboardSetPlayerItemValueBJ(ConvertedPlayer(udg_Sorted[i]), GetLastCreatedLeaderboard(), udg_Bunny[udg_Sorted[i]] )
            set i=i+1
        endloop
    endfunction

    //===========================================================================
    private function init takes nothing returns nothing
        set gg_trg_Bunny_Board = CreateTrigger()
        call TriggerAddAction(gg_trg_Bunny_Board,function BunnyBoard)
    endfunction

	private function PauseEverythingE takes nothing returns boolean
		if bj_pauseAllUnitsFlag then
			call PauseUnit(GetFilterUnit(), true)
			call SetUnitInvulnerable(GetFilterUnit(), true)
		else
			call PauseUnit(GetFilterUnit(), false)
			call SetUnitInvulnerable(GetFilterUnit(), false)
		endif
		return false
	endfunction
	private function PauseEverything takes boolean pause returns nothing
		local integer i = 0
		local group g = CreateGroup()
		set bj_pauseAllUnitsFlag = pause
		loop
			exitwhen i > 13
			call GroupEnumUnitsOfPlayer(g, Player(i), Condition(function PauseEverythingE))
			set i = i + 1
		endloop
		call DestroyGroup(g)
		set g = null
	endfunction


    /*

        local trigger t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), "-test2", true)
        call TriggerAddAction(t,function EndSequenceB)
        set t = null

        set gg_trg_End_Sequence = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(gg_trg_End_Sequence, Player(0), "-test", true)
        call TriggerAddAction(gg_trg_End_Sequence,function EndSequenceA)

    From GeneralShutDown

        ///////////////////////////////////////////////////////////////////
        ///////////Test Purposes only. To be removed on release.///////////
        ///////////////////////////////////////////////////////////////////
        set udg_Visibility = 95
        call SetTimeOfDay(8.00)
        call IntermissionRestore()
        call SetAmbientDaySound( "AshenvaleDay" )
        call SetSkyModel( "Environment\\Sky\\BlizzardSky\\BlizzardSky.mdl" )
        set udg_ZStart = 1300.0
        set udg_ZEnd = 2800.0
        call FogTransition(0.75)
        call GlobalWeather('SNls')
        set udg_Mode=3
        set udg_SectorClear=true
        call VolumeGroupSetVolume(SOUND_VOLUMEGROUP_UNITSOUNDS, 0.7)
        call SetForceAllianceStateBJ( bj_FORCE_PLAYER[11], udg_EchoCompany, bj_ALLIANCE_ALLIED_VISION )
        call SetForceAllianceStateBJ( bj_FORCE_PLAYER[11], udg_EchoCasualties, bj_ALLIANCE_ALLIED_VISION )
        ///////////////////////////////////////////////////////////////////
    */

    function GeneralShutDown takes nothing returns nothing
        local integer i = 1
        loop
            exitwhen i>udg_InitialPlayers
            set udg_NightVision[udg_Sorted[i]] = false
            set i=i+1
        endloop
        loop
            exitwhen udg_Lighting==false
            call PolledWait(1.)
        endloop
        set i=1
        loop
            exitwhen i>udg_InitialPlayers
            call NightVision(ConvertedPlayer(udg_Sorted[i]),udg_NightVision[udg_Sorted[i]])
            set i=i+1
        endloop
        set i=1
        loop
            exitwhen i>udg_Players
            call UnitAddAbility(udg_Hero[udg_Sorted[i]],'Avul')
            set i=i+1
        endloop
        call SetForceAllianceStateBJ(bj_FORCE_PLAYER[11],udg_EchoCompany,bj_ALLIANCE_ALLIED_VISION)
        call SetForceAllianceStateBJ(bj_FORCE_PLAYER[9],udg_EchoCompany,bj_ALLIANCE_ALLIED_VISION)
        call SetPlayerHandicap(Player(13),1.0)
        call SetPlayerHandicap(Player(14),1.0)
        call RemoveAllGuardPositions(Player(9))
        call RemoveAllGuardPositions(Player(11))
        call SetNVGEnabled(false)
       // call DisableTrigger(gg_trg_EM_Sphere)
       // call DisableTrigger(gg_trg_Engineer_Deployment)
        //call DisableTrigger(gg_trg_Bradley_AI)
        //call DisableTrigger(gg_trg_Infantry_AI)
        //call DisableTrigger(gg_trg_Activate_FPS)
        //call DisableTrigger(gg_trg_First_Person_Mode)
        //call DisableTrigger(gg_trg_Up_Arrow_Press)
        //call DisableTrigger(gg_trg_Up_Arrow_Release)
        //call DisableTrigger(gg_trg_Left_Arrow_Press)
        //call DisableTrigger(gg_trg_Left_Arrow_Release)
       // call DisableTrigger(gg_trg_Right_Arrow_Press)
       // call DisableTrigger(gg_trg_Right_Arrow_Release)
        //call DisableTrigger(gg_trg_Down_Arrow)
        call SetArticle15Enabled(false)
        // call DisableTrigger(gg_trg_Article_15)
    endfunction

    function BunnySpawn takes nothing returns nothing
        if GetWidgetLife(udg_Boss)<0.405 then
            call DestroyTrigger(GetTriggeringTrigger())
            return
        endif
        call GankUnit(udg_Boss,Player(13),'n00T',2+(3*udg_InitialPlayers),400,800)
        if GetRandomInt(0,2)==1 then
            call GankUnit(udg_Boss,Player(13),'n00U',GetRandomInt(1,3),400,800)
        endif
        if GetRandomInt(0,10)==1 then
            set udg_soundpath = "Sound\\Interface\\GlueScreenMeteorLaunch3.wav"
            call PlaySoundPath.execute()
        endif
    endfunction

    function BunnyLoveConditions takes nothing returns boolean
        local integer i = GetUnitTypeId(GetTriggerUnit())
        return (i=='n00T' or i=='n00U') and GetUnitAbilityLevel(GetTriggerUnit(),'A05S')<1
    endfunction

    function BunnyLove takes nothing returns nothing
        local unit u = GetTriggerUnit()
        local player p = GetTriggerPlayer()
        local integer i = GetConvertedPlayerId(p)
        local real bunnypoint = 2
        call UnitAddAbility(u,'A05S')
        if GetUnitTypeId(u)=='n00T' then
            set udg_mystring = "+2 XP (" + GetPlayerName(p) + ")"
           call AddFadingTextTag(udg_mystring,GetUnitX(u),GetUnitY(u),0,220,255,200)
        else
            set bunnypoint = 4
            set udg_mystring = "+4 XP (" + GetPlayerName(p) + ")"
            call AddFadingTextTag(udg_mystring,GetUnitX(u),GetUnitY(u),255,220,0,200)
        endif
        set udg_Experience[i] = udg_Experience[i] + bunnypoint
        set udg_Bunny[i] = udg_Bunny[i]+1
        if GetRandomInt(0,1)==1 then
            call SetUnitExploded(u,true)
        endif
        call KillUnit(u)
        set u = null
        if GetWidgetLife(udg_Boss)<0.405 then
            call DestroyTrigger(GetTriggeringTrigger())
        endif
    endfunction

    function filler takes nothing returns nothing
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0," ")
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0," ")
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0," ")
    endfunction

    function SequenceACredits takes nothing returns nothing //Bunny Game
        local integer i = 1
        local trigger t = CreateTrigger()
        call PolledWait(10.)
        call TriggerAddCondition(t, Condition( function BunnyLoveConditions ) )
        call TriggerAddAction(t, function BunnyLove )
        call CreateLeaderboardBJ(GetPlayersAll(), "Bunny Souls")
        loop
            exitwhen i>udg_InitialPlayers
            set udg_CameraHeight[i] = 0
            call TriggerRegisterPlayerUnitEvent(t, ConvertedPlayer(udg_Sorted[i]), EVENT_PLAYER_UNIT_SELECTED, null)
            call LeaderboardAddItemBJ(ConvertedPlayer(udg_Sorted[i]),GetLastCreatedLeaderboard(),GetPlayerName(ConvertedPlayer(udg_Sorted[i])),0)
            set i=i+1
        endloop
        set t = null
        call SetDynamicEvasionEnabled(false)
        call DisableTrigger(gg_trg_Activate_FPS)
        call LeaderboardDisplay(GetLastCreatedLeaderboard(),true)
        call TriggerRegisterTimerEvent(gg_trg_Bunny_Board,1.0,true)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Capture the bunny souls by clicking on them.")
        call filler()
        call PolledWait(10.)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"NOTD Aftermath")
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Created on 5th September 2005")
        call filler()
        call PolledWait(10.)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Lead Design and Development")
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Azazel_")
        call filler()
        call PolledWait(10.)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Story and Concepts")
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Azazel_")
        call filler()
        call PolledWait(10.)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"JASS and Triggering Support")
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Pipedream, Conquest-NOVA")
        call filler()
        call PolledWait(10.)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Military Inspiration and Ideas")
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"United States Marine Corps")
        call filler()
        call PolledWait(10.)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Original Concept of Night of the Dead II")
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"FM Bilouxi and FM Osiris")
        call filler()
        call PolledWait(10.)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Cast")
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"ALICE, Iron Hand, Lt. Rasczak, Maj. Grimes, Capt. Roth")
        call filler()
        call PolledWait(10.)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Cast (continued)")
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Maj. Jamie Cox, SSgt. Thompson, Capt. Barnes, CWO Wolcott, CWO Durant")
        call filler()
        call PolledWait(10.)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Cast (continued)")
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Etaphreven, Flesh Composite, Loki, Lyganesh, Prometheus")
        call filler()
        call PolledWait(10.)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Cast (continued)")
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Thanatos, Diablo, Osiris, Eris, Atlas, Minos, Fluffy")
        call filler()
        call PolledWait(10.)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Commanche Model")
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Killst4r")
        call filler()
        call PolledWait(10.)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"F-22 Raptor Model")
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Illidan(Evil)X")
        call filler()
        call PolledWait(10.)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"M2 Bradley Model")
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Illidan(Evil)X")
        call filler()
        call PolledWait(10.)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Earth Model")
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"RightField")
        call filler()
        call PolledWait(10.)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Sentry Gun Model")
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Domokun")
        call filler()
        call PolledWait(10.)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Marine Camoflouge Skin")
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Lost_Tribute")
        call filler()
        call PolledWait(10.)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Beta Testers")
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Toony, Yukie, Demon12, ki3nf3i, Amoyensis, j45on, PO_Berserker")
        call filler()
        call PolledWait(10.)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Beta Testers (continued)")
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"allenaw88, MaFlowerCrab, Telperion, Farker, Syrus, kann[nIx]")
        call filler()
        call PolledWait(10.)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Beta Testers (continued)")
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"25cai, hihihihihi, JUNKIE, Dekay, Deftmana, lil_nicky888")
        call filler()
        call PolledWait(10.)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Beta Testers (continued)")
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"USMC-Delta, Clan 3ch0 and Clan Ech0")
        call filler()
        call PolledWait(10.)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Development of Warcraft III")
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"Blizzard Entertainment")
        call filler()
        call PolledWait(10.)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"To all the fans of NOTD Aftermath")
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,7.0,"May you dream of electric sheep")
        call filler()
        call EnableTrigger(gg_trg_Activate_FPS)
        call PolledWait(10.)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,20.0,"Congratulations on completing NOTD Aftermath")
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,20.0,"www.notd-aftermath.com")
        call filler()
    endfunction

    function EndSequenceA takes nothing returns nothing
        local integer i = 1
        local trigger t = CreateTrigger()
        local real x
        local real y
        local real dx
        local real dy
        local group g
        call GeneralShutDown()
        set udg_Boss = CreateUnit(Player(11),'hrtt',-540.0,-6150.0,0.0)
        call UnitAddAbility(udg_Boss,'Avul')
        call RemoveGuardPosition(udg_Boss)
        call UnitRemoveAbility(udg_Boss,'A052')
        set udg_AITarget = udg_Boss
        call SetUnitPathing(udg_Boss,false)
        call IssuePointOrder(udg_Boss,"move",-1470.0,-4864.0)
        call PolledWait(4.)
        call IssuePointOrder(udg_Boss,"move",-997.0,-4128.0)
        call PolledWait(3.)
        call IssuePointOrder(udg_Boss,"move",-1440.0,-1932.0)
        call PolledWait(7.)
        call IssuePointOrder(udg_Boss,"move",-1440.0,-576.0)
        call PolledWait(4.)
        call FieldChat(udg_Hero[1], 5.0, "|cfff3ad00Marine|r : They always said India Company was a hard assed bunch." )
        call PolledWait(6.)
        call StartSound(gg_snd_Loading)
        call SetForceAllianceStateBJ(bj_FORCE_PLAYER[11],udg_EchoCompany,bj_ALLIANCE_ALLIED_VISION)
        call SetForceAllianceStateBJ(bj_FORCE_PLAYER[11],udg_EchoCasualties,bj_ALLIANCE_ALLIED_VISION)
        call SetForceAllianceStateBJ(udg_EchoCompany,bj_FORCE_PLAYER[11],bj_ALLIANCE_ALLIED_VISION)
        call SetForceAllianceStateBJ(udg_EchoCasualties,bj_FORCE_PLAYER[11],bj_ALLIANCE_ALLIED_VISION)
        set udg_DeltaLeader = CreateUnit(Player(11),'z00B',GetUnitX(udg_Boss)+80.0,GetUnitY(udg_Boss)-60.0,0.0)
        call UnitAddItemById(udg_DeltaLeader,'I00H') //XML-9C
        call UnitAddItemById(udg_DeltaLeader,'phea')
        call UnitAddItemById(udg_DeltaLeader,'I00T') //Pet Soul
        call UnitAddItemById(udg_DeltaLeader,'I001') //Composite
        call TriggerSleepAction(0.5)
        call FieldChat(udg_DeltaLeader, 5.0, "|cfff3ad001Lt. Rasczak|r : I heard you girls need a ride!" )
        call IssuePointOrder(udg_DeltaLeader,"move",-1330.0,-576.0)
        call PolledWait(4.0)
        call EnableDragSelect(false,false)
        set x = GetUnitX(udg_Boss)
        set y = GetUnitY(udg_Boss)
        loop
            exitwhen i>udg_InitialPlayers
            if GetWidgetLife(udg_Hero[udg_Sorted[i]])>0.405 then
                call SetUnitOwner(udg_Hero[udg_Sorted[i]],Player(11),false)
                call IssuePointOrder(udg_Hero[udg_Sorted[i]],"move",x,y)
            elseif GetWidgetLife(udg_Pet[udg_Sorted[i]])>0.405 then
                call SetUnitOwner(udg_Pet[udg_Sorted[i]],Player(11),false)
                call IssuePointOrder(udg_Pet[udg_Sorted[i]],"move",x,y)
            endif
            set i=i+1
        endloop
        set udg_RoadX[0] = -1160.0
        set udg_RoadX[1] = -2870.0
        set udg_RoadX[2] = -2956.0
        set udg_RoadX[3] = -5730.0
        set udg_RoadX[4] = -7059.0
        set udg_RoadX[5] = -5090.0
        set udg_RoadX[6] = -6715.0
        set udg_RoadX[7] = -7171.0
        set udg_RoadX[8] = -5483.0
        set udg_RoadX[9] = -1630.0
        set udg_RoadX[10] = 31.0
        set udg_RoadX[11] = 1320.0
        set udg_RoadX[12] = 1947.0
        set udg_RoadX[13] = 166.0
        set udg_RoadX[14] = 6130.0
        set udg_RoadX[15] = 8698.0
        set udg_RoadX[16] = 10212.0
        set udg_RoadX[17] = 14769.0
        set udg_RoadY[0] = 710.0
        set udg_RoadY[1] = 1704.0
        set udg_RoadY[2] = 3200.0
        set udg_RoadY[3] = 3022.0
        set udg_RoadY[4] = 5873.0
        set udg_RoadY[5] = 8222.0
        set udg_RoadY[6] = 10490.0
        set udg_RoadY[7] = 12866.0
        set udg_RoadY[8] = 14240.0
        set udg_RoadY[9] = 12630.0
        set udg_RoadY[10] = 14942.0
        set udg_RoadY[11] = 14626.0
        set udg_RoadY[12] = 12912.0
        set udg_RoadY[13] = 8141.0
        set udg_RoadY[14] = 7172.0
        set udg_RoadY[15] = 6088.0
        set udg_RoadY[16] = 2867.0
        set udg_RoadY[17] = 1274.0
        call PolledWait(6.0)
        call StartSound(gg_snd_Loading)
        set i=1
        loop
            exitwhen i>udg_InitialPlayers
            if GetWidgetLife(udg_Hero[udg_Sorted[i]])>0.405 then
                call RemoveUnit(udg_Hero[udg_Sorted[i]])
                set udg_Hero[udg_Sorted[i]]=null
            elseif GetWidgetLife(udg_Pet[udg_Sorted[i]])>0.405 then
                call RemoveUnit(udg_Pet[udg_Sorted[i]])
                set udg_Pet[udg_Sorted[i]]=null
            endif
            set g = CreateGroup()
            call GroupEnumUnitsOfPlayer(g, ConvertedPlayer(udg_Sorted[i]), null)
            call ForGroup( g, function RemoveUnitAll )
            call DestroyGroup(g)
            set udg_FPSMode[udg_Sorted[i]]=true
            set udg_RotationLock[udg_Sorted[i]]=false
            set udg_FPSUnit[udg_Sorted[i]]=udg_Boss
            set udg_DistancetoTarget[udg_Sorted[i]] = 1000.0
            set i=i+1
        endloop
        set g = null
        call EnableTrigger(gg_trg_First_Person_Mode)
        set udg_soundpath = "Sound\\Music\\mp3Music\\PH1.mp3"
        call PlaySoundPath.execute()
        call PolledWait(2.)
        call FieldChat(udg_DeltaLeader, 4.0, "|cfff3ad001Lt. Rasczak|r : Ahhh, another day's work. I love this job." )
        call PolledWait(1.)
        call IssuePointOrder(udg_DeltaLeader,"move",-1440.0,-576.0)
        call StartSound(gg_snd_Loading)
        call RemoveUnit(udg_DeltaLeader)
        call PolledWait(2.)
        call SequenceACredits.execute()
        call TriggerRegisterTimerEvent( t, 12.0,true )
        call TriggerAddAction( t, function BunnySpawn )
        set t = null
        set i=0
        loop
            exitwhen i>17
            call IssuePointOrder(udg_Boss,"move",udg_RoadX[i],udg_RoadY[i])
            loop
                set dx = GetUnitX(udg_Boss) - udg_RoadX[i]
                set dy = GetUnitY(udg_Boss) - udg_RoadY[i]
                exitwhen dx*dx+dy*dy<=40000.0
                call PolledWait(1.)
            endloop
            set i=i+1
        endloop
        call RemoveUnit(udg_Boss)
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 2.0, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
        call DisableTrigger(gg_trg_First_Person_Mode)
        call DisableTrigger(gg_trg_Bunny_Board)
    endfunction

    function EndSequenceB takes nothing returns nothing
        local integer i = 1
        local unit u
        local unit u2
        local unit u3
        local unit u4
        if GetWidgetLife(udg_AirfieldF22[1])>0.405 then
            call RemoveUnit(udg_AirfieldF22[1])
        endif
        if GetWidgetLife(udg_AirfieldF22[2])>0.405 then
            call RemoveUnit(udg_AirfieldF22[2])
        endif
        call GeneralShutDown()
        set udg_Lighting=true
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUTIN, 3.0, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 25.00 )
        call PolledWait(3.0)
        call ClearTextMessages()
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 2.0, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
        call ShowInterface(false, 2.0)
        call PolledWait(4.0)
        call ALICEText(30.0, "ALICE Transmission Log 0311" )
        call PolledWait(3.5)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,30.0, "Containment Successful" )
        call PolledWait(1.5)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,30.0, "Nuclear Facilities Intact" )
        call PolledWait(1.5)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,30.0, "Operational Damage : Minimal" )
        call PolledWait(1.5)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,30.0, "Unknown Entities Accounted for : 99.3%" )
        call PolledWait(1.5)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,30.0, " " )
        call PolledWait(1.5)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,30.0, " " )
        call PolledWait(1.5)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,30.0, "Debriefing of Third Platoon, Echo Company scheduled at 1100 hours." )
        call PolledWait(6.0)
        call ClearTextMessages()
        call FogMaskEnableOff()
        set udg_EvasionCapability = 10
        call FogEnableOff()
        set u = CreateUnit(Player(11),'hrtt',-1016.0,456.0,160.0)
        call RemoveGuardPosition(u)
        call SetUnitPathing(u,false)
        call CreateUnit(Player(11),'z008',-1103.0,396.0,168.0)
        call TriggerSleepAction(0.)
        call CreateUnit(Player(11),'z008',-1038.0,308.0,260.0)
        call TriggerSleepAction(0.)
        call CreateUnit(Player(11),'z008',-561.0,-763.0,5.0)
        call TriggerSleepAction(0.)
        call CreateUnit(Player(11),'z008',-641.0,-560.0,90.0)
        call TriggerSleepAction(0.)
        call CreateUnit(Player(11),'z008',-1664.0,-312.0,210.0)
        call TriggerSleepAction(0.)
        set u3 = CreateUnit(Player(11),'h009',-1386.0,-681.0,95.0)
        set udg_LZPoint = Location(-1386.0,-618.0)
        call SetUnitScalePercent(u3,50.0,50.0,50.0)
        call RemoveGuardPosition(u3)
        call TriggerSleepAction(0)
        set u2 = CreateUnit(Player(11),'z008',0.0,0.0,0.0)
        //////////////////////////////////////////
        ////////////////  Scene A  ///////////////
        //////////////////////////////////////////
        call StartSound(gg_snd_SatCamZoom2)
        call CameraSetupApplyForceDuration(gg_cam_ReportEnd1, true, 0.0)
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 2.0, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
        call PolledWait(2.5)
        call StartSound(gg_snd_BlackHawkRotor)
        call SetUnitFlyHeight(u3,15.0,130.0)
        call SmoothUnitResize(u3,0.6,1.2,4)
        call IssuePointOrder(u2,"move",-1011.0,-215.0) //Capt. Roth meets Doc. Freeman
        call PolledWait(3.0)
        call StartSound(gg_snd_CobraRotor)
        set u = CreateUnit(Player(11),'hgyr',-2414.0,395.0,246.0)
        call IssuePointOrder(u,"move",306.0,-105.0)
        call PolledWait(0.5)
        call SetUnitTimeScalePercent(u3,65.0)
        call BlackHawkWashOff.execute()
        call StartSound(gg_snd_BlackHawkLand)
        call PolledWait(1.0)
        call FieldChat(u2, 5.0, "|cfff3ad00Capt. Roth|r : Dr. Freeman, we've got a live one!" )
        call PolledWait(2.0)
        call StartSound(gg_snd_Loading)
        set u = CreateUnit(Player(11),'z001',-1300.0,-550.0,62.0) //Corpsman
        call IssuePointOrder(u,"move",0.0,0.0)
        call FieldChat(u, 7.0, "|cfff3ad00Dr. Freeman|r : We'll need some samples immediately." )
        call TriggerSleepAction(0.5)
        call StartSound(gg_snd_Loading)
        set u = CreateUnit(Player(11),'z001',-1300.0,-520.0,72.0) //Corpsman
        call IssuePointOrder(u,"move",0.0,0.0)
        call PolledWait(3.5)
        call IssuePointOrder(u2,"move",0.0,0.0)
        set u2 = CreateUnit(Player(13),'U00K',694.0,5356.0,0.0) //Minos
        call SuspendHeroXP(u2,true)
        call ShiftMoveSpeed(u2,-135.0)
        call TriggerSleepAction(0.)
        call CreateUnit(Player(11),'z008',886.0,5786.0,250.0)
        call TriggerSleepAction(0.)
        set u4 = CreateUnit(Player(11),'z005',1019.0,5748.0,254.0)
        call TriggerSleepAction(0.)
        call CreateUnit(Player(11),'z008',1108.0,5652.0,237.0)
        call TriggerSleepAction(0.)
        call CreateUnit(Player(11),'z008',941.0,4803.0,116.0)
        call TriggerSleepAction(0.)
        set u = CreateUnit(Player(11),'z003',1006.0,4860.0,113.0) //Engineer (for Net sequence)
        call SetUnitAcquireRangeBJ(u,1200.0)
        call TriggerSleepAction(0.)
        set u3 = CreateUnit(Player(11),'z009',864.0,4830.0,111.0) //Flamethrower
        call SetUnitAcquireRangeBJ(u3,1200.0)
        call ShiftMoveSpeed(u2,65.0)
        //////////////////////////////////////////
        ////////////////  Scene B  ///////////////
        //////////////////////////////////////////
        call CameraSetupApplyForceDuration(gg_cam_ReportEnd2, true, 0.0)
        call StartSound(gg_snd_SatCamShot)
        call PolledWait(1.)
        call IssueTargetOrder(u,"ensnare",u2)
        call PolledWait(4.)
        call IssueTargetOrder(u3,"breathoffire",u2)
        set udg_soundpath = "Sound\\Interface\\GlueScreenMeteorLaunch3.wav"
        call PlaySoundPath.execute()
        call IssuePointOrder(u4,"move",1421.0,5468.0)
        call PolledWait(3.0)
        set udg_soundpath = "Sound\\Interface\\GlueScreenMeteorLaunch3.wav"
        call PlaySoundPath.execute()
        call ArtHandler(u, GetUnitX(u2), GetUnitY(u2),15,1.0,150.0,2.5,1)
        call PolledWait(1.5)
		call KillUnit(u2)
		call PolledWait(1.5)
        call FieldChat(u4, 3.0, "|cfff3ad00Delta|r : Fuck.." )
        call PolledWait(3.)
        set udg_soundpath = "war3mapImported\\SatCamShot.mp3"
        call PlaySoundPath.execute()
        call CinematicFilterGenericBJ( 0.1, BLEND_MODE_MODULATE_2X, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 0.0, 25, 0.0, 100, 100.0, 100.00, 100.00, 5.00 )
        call PolledWait(0.3)
        call CinematicFilterGenericBJ( 0.0, BLEND_MODE_MODULATE_2X, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 100.00, 100, 100.00, 5, 0, 0, 0, 100.00 )
        call CinematicFilterGenericBJ( 0.0, BLEND_MODE_BLEND, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 20.00, 20.00, 20.00, 0.00, 20.00, 20.00, 20.00, udg_Visibility )
        call PolledWait(1.0)

        set u = CreateUnit(Player(9),'z008',14789.0,12487.0,212.0)
        call UnitAddItemById(u,'I00I') //SMAW
        call UnitAddAbility(u,'Avul')
        call TriggerSleepAction(0.)
        call CreateUnit(Player(13),'z002',12911.0,11227.0,150.0)
        call TriggerSleepAction(0.)
        call CreateUnit(Player(13),'z002',13090.0,11525.0,154.0)
        call TriggerSleepAction(0.)
        call CreateUnit(Player(13),'n002',13020.0,11375.0,184.0)
        call SpawnPoint(14644.0,12465.0,Player(11),'z009',2) //FB South
        call SpawnPoint(13403.0,12810.0,Player(11),'z009',1) //FB East
        //////////////////////////////////////////
        ////////////////  Scene C  ///////////////
        //////////////////////////////////////////
        call CameraSetupApplyForceDuration(gg_cam_ReportEnd3a, true, 0.0)
        call StartSound(gg_snd_SatCamShot)
        call IssuePointOrder(u,"move",14471.0,12263.0)
        call PolledWait(1.7)
        call UnitUseItemPoint(u,GetUnitItem(u,'I00I'),13333.0,11515.0)
        call SpawnPoint(13675.0,10529.0,Player(13),'n00M',3) //Fast Zomb West
        call UnitRemoveItem(u,GetLastCreatedItem())
        call AICommand(Player(11),"move",13860.0,11922.0)
        call SpawnPoint(13655.0,10529.0,Player(13),'n00N',5) //HP Zomb West
        call TickAINeutralVictim()
        call SpawnPoint(13680.0,10529.0,Player(13),'u00R',3) //Super Ghoul
        call SpawnPoint(12150.0,10602.0,Player(13),'n00M',4) //Fast Zomb North
        set udg_AITarget = u
        call TickAINeutralVictim()
        call SpawnPoint(12180.0,10602.0,Player(13),'n00N',4) //HP Zomb North
        call SpawnPoint(12127.0,10602.0,Player(13),'u00R',3) //Super Ghoul
        call SpawnPoint(14644.0,12465.0,Player(11),'z00D',3) //Marines South
        call SpawnPoint(13403.0,12810.0,Player(11),'z00D',3) //Marines East
        call TickAINeutralVictim()
        call AICommand(Player(11),"move",13860.0,11922.0)
        set udg_DeltaOperator[1] = CreateUnit(Player(9),'z00D',13530.0,12748.0,210.0) //Suppressive Fire
        call IssuePointOrder(udg_DeltaOperator[1],"move",13685.0,12508.0)
        call TriggerSleepAction(0.)
        set udg_DeltaOperator[2] = CreateUnit(Player(9),'z00D',13530.0,12748.0,210.0) //Suppressive Fire
        call IssuePointOrder(udg_DeltaOperator[2],"move",13653.0,12520.0)
        call TriggerSleepAction(0.)
        set udg_DeltaOperator[3] = CreateUnit(Player(9),'z00D',14570.0,12409.0,210.0) //Suppressive Fire
        call IssuePointOrder(udg_DeltaOperator[3],"move",14080.0,12377.0)
        call TriggerSleepAction(0.)
        set udg_DeltaOperator[4] = CreateUnit(Player(9),'z00D',14500.0,12409.0,210.0) //Suppressive Fire
        call IssuePointOrder(udg_DeltaOperator[4],"move",14000.0,12357.0)
        call TriggerSleepAction(0.)
        call PolledWait(1.0)
        call AICommand(Player(11),"attack",13860.0,11922.0)
        call PolledWait(4.0)
        call CameraSetupApplyForceDuration(gg_cam_ReportEnd3b, true, 18.0)
        set u2 = CreateUnit(Player(9),'hgyr',13434.0,12797.0,210.0) //South Cobra
        call IssuePointOrder(u2,"attack",13110.0,11296.0)
        call TriggerSleepAction(0.)
        set u3 = CreateUnit(Player(9),'hgyr',14153.0,12892.0,210.0) //East Cobra
        call IssuePointOrder(u3,"attack",13110.0,11296.0)
        call TriggerSleepAction(0.)
        call AICommand(Player(11),"move",13860.0,11922.0)
        call SpawnPoint(13675.0,10529.0,Player(13),'u00C',3) //Garg West
        call SpawnPoint(13655.0,10529.0,Player(13),'n00N',3) //HP Zomb West
        call ArtHandler(u2,13130.0, 10851.0,10,1.0,400.0,6.0,1)
        call SpawnPoint(12150.0,10602.0,Player(13),'u00R',2) //Super Ghoul North
        call SpawnPoint(12180.0,10602.0,Player(13),'n00N',4) //HP Zomb North
        call TickAINeutralVictim()
        call AICommand(Player(11),"attack",13860.0,11922.0)
        call PolledWait(4.)
        call AICommand(Player(11),"move",13680.0,11922.0)
        call PolledWait(1.2)
        call AICommand(Player(11),"attack",13680.0,11922.0)
        set u4 = CreateUnit(Player(9),'hrtt',13090.0,12911.0,210.0)
        call IssuePointOrder(u4,"move",13133.0,12311.0)
        call SpawnPoint(13675.0,10500.0,Player(13),'u00C',3) //Garg West
        set u = CreateUnit(Player(13),'U00B',13675.0,10529.0,0.0) //Loki
        call SuspendHeroXP(u,true)
        call SpawnPoint(13655.0,10529.0,Player(13),'n00N',3) //HP Zomb West
        call SpawnPoint(12150.0,10502.0,Player(13),'u00R',3) //Super Ghoul North
        call SpawnPoint(12180.0,10600.0,Player(13),'n00N',3) //HP Zomb North
        call IssuePointOrder(u2,"move",14126.0,10715.0)
        call SetUnitFlyHeight(u2,400.0,100.0)
        call TickAINeutralVictim()
        call IssuePointOrder(udg_DeltaOperator[1],"move",13947.0,12311.0)
        call IssuePointOrder(u3,"move",13232.0,10544.0)
        call SetUnitFlyHeight(u3,400.0,100.0)
        call PolledWait(5.)
        call IssuePointOrder(udg_DeltaOperator[2],"move",13800.0,12200.0)
        call RemoveUnit(u2)
        call RemoveUnit(u3)
        set u = CreateUnit(Player(13),'U009',12180.0,10600.0,0.0) //Atlas
        call SuspendHeroXP(u,true)
        call TickAINeutralVictim()
        call IssuePointOrder(udg_DeltaOperator[3],"move",12585.0,12161.0)
        call PolledWait(4.)
        call AICommand(Player(11),"attack",13791.0,11143.0)
        call IssuePointOrder(udg_DeltaOperator[4],"move",12450.0,12100.0)
        call PolledWait(8.)
        //Coccoons
        set u = CreateUnit(Player(13),'e00H',-7709.0,-4207.0,0.0)
        call SetUnitTimeScalePercent(u,22.0)
        call TriggerSleepAction(0.)
        set u = CreateUnit(Player(13),'e00H',-7230.0,-3744.0,0.0)
        call SetUnitTimeScalePercent(u,33.0)
        call TriggerSleepAction(0.)
        set u = CreateUnit(Player(13),'e00H',-7640.0,-3868.0,0.0)
        call SetUnitTimeScalePercent(u,28.0)
        //////////////////////////////////////////
        ////////////////  Scene D  ///////////////
        //////////////////////////////////////////
        call CameraSetupApplyForceDuration(gg_cam_ReportEnd4a, true, 0.0)
        call StartSound(gg_snd_SatCamShot)
        call PolledWait(3.)
        call CameraSetupApplyForceDuration(gg_cam_ReportEnd4b, true, 20.0)
        loop
            exitwhen i>5
            set udg_soundpath = "war3mapImported\\HeartBeat.wav"
            call PlaySoundPath.execute()
            call PolledWait(1.9+(i*0.1))
            set i=i+1
        endloop
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 6.0, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
        call PolledWait(0.8)
        call SetAINeutralVictimEnabled(false)
        call SetAINeutralExtraEnabled(false)
        set udg_soundpath = "war3mapImported\\HeartBeat.wav"
        call PlaySoundPath.execute()
        call PolledWait(2.2)
        set udg_soundpath = "war3mapImported\\HeartBeat.wav"
        call PlaySoundPath.execute()
        call PauseEverything(true)
        call PolledWait(2.5)
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, "                                              |cff8b864eO, woe is me,|r" )
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, "                                              |cff8b864eTo have seen what I have seen, see what I see!|r" )
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, "                                                       - William Shakespeare, Hamlet, Act 3 scene 1" )
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, " ")
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, " ")
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, " ")
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, " ")
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, " ")
        set udg_soundpath = "war3mapImported\\HeartBeat.wav"
        call PlaySoundPath.execute()
        call PolledWait(3.)
        set udg_soundpath = "war3mapImported\\HeartBeat.wav"
        call PlaySoundPath.execute()
        call PolledWait(10.)
        call ShowInterface(true,3.0)
        set udg_Lighting = false
        set u = null
        set u2 = null
        set u3 = null
        set u4 = null
    endfunction

    function EndSequenceC takes nothing returns nothing
        local integer i = 1
        local real x
        local real y
        local unit u
        local unit u2
        local rect r
        local location l
        call GeneralShutDown()
        set udg_ZStart = 1600.0
        set udg_ZEnd = 5000.0
        call FogTransition(0.75)
        set udg_Lighting=true
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUTIN, 3.0, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 25.0 )
        call PolledWait(3.)
        call ClearTextMessages()
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 2.0, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
        call ShowInterface(false, 2.0)
        call PolledWait(4.)
        call ALICEText(30.0, "ALICE Transmission Log 0311" )
        call PolledWait(3.5)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,30.0, "Containment Successful" )
        call PolledWait(1.5)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,30.0, "Nuclear Facilities Disabled" )
        call PolledWait(1.5)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,30.0, "Operational Damage : Critical" )
        call PolledWait(1.5)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,30.0, "Unknown Entities Accounted for: 68.4%" )
        call PolledWait(1.5)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,30.0, " " )
        call PolledWait(1.5)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,30.0, " " )
        call PolledWait(1.5)
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,30.0, "Mission files classified. Third Platoon, Echo Company killed in freak accident." )
        call PolledWait(6.)
        call ClearTextMessages()
        call FogMaskEnableOff()
        set udg_EvasionCapability = 10
        call FogEnableOff()
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 3.0, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
        //////////////////////////////////////////
        ///////////////   Scene 1  ///////////////
        //////////////////////////////////////////
        call CameraSetupApplyForceDuration(gg_cam_LockDown1a, true, 0.0)
        set u = CreateUnit(Player(9),'z00D',9498.0,-392.0,210.0)
        call UnitApplyTimedLife(u,'Bhwd',15.0)
        call PolledWait(2.)
        call IssuePointOrder(u,"move",12027.0,271.0)
        call PolledWait(1.2)
        set u = CreateUnit(Player(13),'U006',9498.0,-392.0,210.0)
        call UnitApplyTimedLife(u,'Bhwd',15.0)
        call IssuePointOrder(u,"attack",12027.0,271.0)
        call PolledWait(3.)
        set udg_soundpath = "Units\\Creeps\\AzureDragon\\DragonYes3.wav"
        call PlaySoundPath.execute()
        call PolledWait(1.)
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 1.0, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
        call PolledWait(1.)
        set u = CreateUnit(Player(11),'h00B',-3350.0,5030.0,0.0) //Raptor 1
        call SetUnitFlyHeight(u,800,800.0)
        call UnitApplyTimedLife(u,'Bhwd',15.0)
        call TriggerSleepAction(0.)
        set u2 = CreateUnit(Player(11),'h00B',-3037.0,5000.0,0.0) //Raptor 2
        call SetUnitFlyHeight(u2,800,800.0)
        call UnitApplyTimedLife(u2,'Bhwd',15.0)
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 1.0, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
        //////////////////////////////////////////
        ///////////////   Scene 2  ///////////////
        //////////////////////////////////////////
        call CameraSetupApplyForceDuration(gg_cam_LockDown2a, true, 0.0)
        call IssuePointOrder(u,"move",-3485.0,1025.0)
        call IssuePointOrder(u2,"move",-2858.0,460.0)
        call StartSound(gg_snd_F22Engine)
        call PolledWait(0.8)
        call StartSound(gg_snd_F22Bay)
        call PolledWait(1.2)
        call StartSound(gg_snd_F22Rocket)
        set u2 = CreateUnit(Player(11),'h00C',GetUnitX(u),GetUnitY(u),0.0)
        call UnitApplyTimedLife(u2,'Bhwd',5.0)
        call IssuePointOrder(u2,"attackground",-3400.0,500.0)
        call PolledWait(2.)
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 1.0, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
        call PolledWait(1.)
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 1.0, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
        //////////////////////////////////////////
        ///////////////   Scene 3  ///////////////
        //////////////////////////////////////////
        call CameraSetupApplyForceDuration(gg_cam_LockDown3a, true, 0.0)
        call PolledWait(1.5)
        set udg_soundpath = "Sound\\Interface\\GlueScreenMeteorLaunch3.wav"
        call PlaySoundPath.execute()
        call PolledWait(2.)
        set x = -219.0
        set y = 4543.0
        set l = Location(x,y)
        set r = Rect( x-800, y-800, x+800, y+800 )
        set u = CreateUnit(Player(11),'e00K',x,y,0.0) //Mushroom Cloud
        call UnitApplyTimedLife(u,'Bhwd',7.5)
        call PolledWait(1.)
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 0.8, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 80, 80, 80, 25.0 )
        call StartSound(gg_snd_Shiva)
        call PolledWait(1.5)
        call SetTerrainFogEx( 0, 600, 2500, 0.550, 0.6, 0.6, 0.6 ) //Red Fog
        //set u2 = CreateUnit(Player(11),'e004',x,y,0.0) //Shiva Radiation
        //call UnitApplyTimedLife(u2,'Bhwd',60.0)
        call SetTerrainFogEx( 0, 600, 2500, 0.550, 0.7, 0.6, 0.6 ) //Red Fog
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 0.5, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 0, 0, 0, 0 )
        //call TerrainDeformationCraterBJ(2.0, true, l, 900.0, 35.0)
        //call MicroWeather('WOlw',l,900.0,60.0)
        call SetTerrainTypeBJ(l,'Xdrt',-1,8,0)
        call SetTerrainFogEx( 0, 600, 2500, 0.550, 0.75, 0.6, 0.6 ) //Red Fog
        call EnumItemsInRect(r,null,function killitem)
        set udg_myinteger = 10
        call EnumDestructablesInRect(r,null,function killtree)
        call UnitDamagePoint(u2,0,900.0,x,y,75000.0,true,false,ATTACK_TYPE_SIEGE,DAMAGE_TYPE_DEMOLITION,WEAPON_TYPE_WHOKNOWS)
        call RemoveLocation(l)
        set i = 1
        loop
            exitwhen i>6
            set l = GetRandomLocInRect(r)
            set u2 = CreateUnit(Player(11),'o002',GetLocationX(l),GetLocationY(l),0.0)
            call UnitApplyTimedLife(u2,'Bhwd',60.0)
            call TriggerSleepAction(0.)
            call RemoveLocation(l)
            set i=i+1
        endloop
        call SetTerrainFogEx( 0, 600, 2500, 0.550, 0.8, 0.6, 0.6 ) //Red Fog
        call PolledWait(2.)
        call RemoveRect(r)
        call PolledWait(2.5)
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 1.0, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
        call PolledWait(1.)
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 1.0, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
        //////////////////////////////////////////
        ///////////////   Scene 4  ///////////////
        //////////////////////////////////////////
        call CameraSetupApplyForceDuration(gg_cam_LockDown4a, true, 0.0)
        call StartSound(gg_snd_ShivaMeltdown)
        set i = 1
        loop
            exitwhen i > 12
            set l = GetRandomLocInRect(gg_rct_ForestScorched)
            set u2 = CreateUnit(Player(11),'o002',GetLocationX(l),GetLocationY(l),0.0)
            call UnitApplyTimedLife(u2, 'Bhwd', 60.0)
            if GetRandomInt(0,1)==1 then
                call TriggerSleepAction(0.)
            endif
            call RemoveLocation(l)
            set i = i + 1
        endloop
        call PolledWait(5.)
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 1.0, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
        call PolledWait(1.)
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 1.0, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
        //////////////////////////////////////////
        ///////////////   Scene 5  ///////////////
        //////////////////////////////////////////
        call CameraSetupApplyForceDuration(gg_cam_LockDown5a, true, 0.0)
        call StartSound(gg_snd_ShivaMeltdown)
        set i = 1
        loop
            exitwhen i > 12
            set l = GetRandomLocInRect(gg_rct_TownScorched)
            set u2 = CreateUnit(Player(11),'o002',GetLocationX(l),GetLocationY(l),0.0)
            call UnitApplyTimedLife(u2, 'Bhwd', 60.0)
            if GetRandomInt(0,1)==1 then
                call TriggerSleepAction(0.)
            endif
            call RemoveLocation(l)
            set i = i + 1
        endloop
        call PolledWait(5.)
        set udg_soundpath = "Sound\\Music\\mp3Music\\TragicConfrontation.mp3"
        call PlaySoundPath.execute()
        call PolledWait(1.5)
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 2.0, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
        call PolledWait(1.)
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 8.0, "                                                                            |cff8b864eNOTD AFTERMATH|r" )
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 8.0, "                                                                       www.notd-aftermath.com" )
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 8.0, " " )
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 8.0, " " )
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 8.0, " " )
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 8.0, " " )
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 8.0, " " )
        call PauseEverything(true)
        call PolledWait(7.)
        call ShowInterface(true,2.0)
        set u = null
        set u2 = null
        set l = null
        set r = null
    endfunction

    function EndSequenceD takes nothing returns nothing
        call ClearTextMessages()
        set udg_soundpath = "Sound\\Music\\mp3Music\\OrcDefeat.mp3"
        call PlaySoundPath.execute()
        call ShowInterface(false,2.0)
        call PauseEverything(true)
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 2.0, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
        call PolledWait(3.)
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 7.0, "  In the weeks following clean up operations, no survivors were found in Boston." )
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 7.0, " " )
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 7.0, " " )
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 7.0, " " )
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 7.0, " " )
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 7.0, " " )
        call PolledWait(8.)
        call ClearTextMessages()
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, "  In public record, Captain Barnes and his men died valiantly fighting to save the country. Captain Barnes was awarded a Navy Cross post-humously." )
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, " " )
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, " " )
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, " " )
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, " " )
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, " " )
        call PolledWait(8.)
        call ShowInterface(true,2.0)
    endfunction

    function EndSequenceE takes nothing returns nothing //Containment Win
        call ClearTextMessages()
        call PauseEverything(true)
        set udg_soundpath = "Sound\\Music\\mp3Music\\OrcDefeat.mp3"
        call PlaySoundPath.execute()
        call ShowInterface(false,2.0)
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 2.0, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
        call PolledWait(5.)
        call ALICEText(7.0, "  Sector E Damage Assessment" )
        call PolledWait(3.)
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 7.0, "  Status - Sanitized" )
        call PolledWait(3.)
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 7.0, "  Containment - " + I2S(GetRandomInt(90,100)) +"% Complete" )
        call PolledWait(3.)
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 7.0, "  Casualties - " + I2S(GetRandomInt(200,300)))
        call PolledWait(5.)
        call ClearTextMessages()
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, "  A day as foul and fair I have never seen. - Macbeth" )
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, " " )
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, " " )
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, " " )
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, " " )
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, " " )
        call PolledWait(8.)
        call ShowInterface(true,2.0)
    endfunction
	
	function EndSequenceF takes nothing returns nothing //Containment Win
        call ClearTextMessages()
        call PauseEverything(true)
        set udg_soundpath = "Sound\\Music\\mp3Music\\OrcDefeat.mp3"
        call PlaySoundPath.execute()
       // call ShowInterface(false,2.0)
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 2.0, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
        call PolledWait(5.)
   //     call ALICEText(7.0, "  Sector E Damage Assessment" )
        call PolledWait(3.)
      //  call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 7.0, "  Containment - Failed" )
        call PolledWait(3.)
      //  call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 7.0, "  Containment - " + I2S(GetRandomInt(90,100)) +"% Complete" )
        call PolledWait(3.)
      //  call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 7.0, "  Casualties - " + I2S(GetRandomInt(200,300)))
        call PolledWait(5.)
       // call ClearTextMessages()
       // call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, "  A day as foul and fair I have never seen. - Macbeth" )
       // call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, " " )
       // call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, " " )
      //  call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, " " )
      //  call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, " " )
      //  call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 15.0, " " )
        call PolledWait(8.)
       // call ShowInterface(true,2.0)
    endfunction

	
endlibrary